package com.blazemina.mina.protocol.amf;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
 * @description amf传输协议工厂，负责创建 <code>ProtocolEncoder</code>及 <code>ProtocolDecoder</code>
 * @author JackChu
 * @created 2009-9-3 下午03:28:05
 */
public class AmfCodecFactory implements ProtocolCodecFactory {
	private ProtocolEncoder encoder;
	private ProtocolDecoder decoder;
	
	public AmfCodecFactory(){
		encoder = new AmfResponseEncoder();
		decoder = new AmfRequestDecoder();
	}
	
	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return decoder;
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		return encoder;
	}

}
